<template>

</template>

<script>
export default {
  name: 'HandleDelete',
  data() {
    return {
      key: 'id',
    }
  },
  methods: {
    /**
     * 列表通用删除前校验方法
     */
    beforeDeleteForCheck(ids) {
      return new Promise((resolve, reject) => {

      }).catch(err => {

      })
    },

    /**
     * 列表通用删除方法
     */
    deleteData(row) {
      return new Promise((resolve, reject) => {

      }).catch(err => {

      })
    },

    handleDelete(row) {
      let ids = row ?     row[this.key] : this.ids.join(',')
      this.beforeDeleteForCheck(ids).then(res => {
        if (res) {
          this.deleteData(row)
        }
      }).catch(err => {
        this.$GlobalErrorConfirm('删除失败', err.msg)
      })
    },


    /**
     * 左侧树形通用删除前校验方法
     */
    beforeDeleteTreeForCheck(id) {
      return new Promise((resolve, reject) => {

      }).catch(err => {

      })
    },

    /**
     * 左侧树形通用删除方法
     */
    deleteTreeData(id) {
      return new Promise((resolve, reject) => {

      }).catch(err => {

      })
    },

    handleDeleteTree(id) {
      this.beforeDeleteTreeForCheck(id).then(res => {
        if (res) {
          this.deleteTreeData(id)
        }
      }).catch(err => {
        this.$GlobalErrorConfirm('删除失败', err.msg)
      })
    }
  }
}
</script>

<style scoped>

</style>
